
//
//  DiscoverMCircleDetailViewController.m
//  HAODE
//
//  Created by panquanReabam.com on 15/9/14.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
//
#import "DiscoverMCircleDetailViewController.h"
#import "RDVTabBarController.h"
#import "RepairCell.h"
#import "Repairmodel.h"
#import "UIImageView+WebCache.h"

#import "HttpRequest.h"
#import "TheLoginViewController.h"
#import "HAODEsingleton.h"
#import "addRepairViewController.h"
#import "imageview.h"
#import "addRepairViewController.h"
#import "UIButton+WebCache.h"
#import "MCircleCell.h"
#import "HcCustomKeyboard.h"
@interface DiscoverMCircleDetailViewController ()<UIScrollViewDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITableViewDataSource,UITableViewDelegate,UITextViewDelegate,HcCustomKeyboardDelegate>

@property (nonatomic, strong) UIImageView * allImageBtn;
@property(nonatomic,strong)NSString*sta;
@end

@implementation DiscoverMCircleDetailViewController{
    int index;
    NSString * hasNext;
    NSString *nextIndex;
    NSMutableArray *allComment;
    NSMutableArray *amt;
    NSMutableArray *detail;
    NSMutableArray *provinceName;
    NSMutableArray *cityName;
    NSMutableArray *status;
    NSMutableArray*imageUrlFull;
    NSMutableArray *time;
    NSMutableArray *reqId;
    NSMutableArray *address;
    NSMutableArray *userName;
    HAODEsingleton*commdity;
    UIButton*sat;
    UIButton*sat1;
    UIButton*sxuan;
    int tapImageCount;
    UIScrollView*MYmainScroll;
    NSMutableArray*arr;
    imageview*imageView;
    UIView*view;
    UIButton*i22;
    UIButton*i1;
    UIButton*i12;
    NSMutableArray *cDate;
    NSMutableArray *content;
    NSMutableArray *headImage;
    UITextView*tv;
    UIImageView*imagess;
    UILabel*label;
    UILabel *line1;
    UIScrollView *scroll;
}
@synthesize alt = alt;
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}
-(void)BackAction:(UIButton *)sender{
    
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
        
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden = NO;
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage =[[UIImage alloc] init];
    
    [self setup];
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"话题详情";
    commdity=[HAODEsingleton shared];
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     backColor,
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
    
    
    
 
    
}

- (void)setup{
    
    _table.delegate = self;
    _table.dataSource = self;

   _table.separatorStyle=UITableViewCellSeparatorStyleNone;
   
    [self.view addSubview:_table];
    content=[[NSMutableArray alloc]init];
    userName=[[NSMutableArray alloc]init];
    headImage=[[NSMutableArray alloc]init];
    cDate=[[NSMutableArray alloc]init];
    
    NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
    NSString* tokenId = [user1 objectForKey:@"tokenId"];
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setValue:tokenId forKey:@"tokenId"];
    [params setValue:commdity.reqId forKey:@"mcId"];
    
    NSLog(@"-----%@",params);
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:20 view:self.view];
    [HttpRequest requestData:@"/Discover/MCircle/Detail" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"-----%@",severDataDict.dataDict);
            
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                arr=[[severDataDict.dataDict objectForKey:@"mcircle"]objectForKey:@"images"];
                
        
                
                view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 250)];
                view.backgroundColor=[UIColor whiteColor];
              

                UIImageView*image=[[UIImageView alloc]initWithFrame:CGRectMake(15, 20, 40, 40)];
                
                [image setImageWithURL:[NSURL URLWithString:[[severDataDict.dataDict objectForKey:@"mcircle"]objectForKey:@"headImage"]] placeholderImage:[UIImage imageNamed:@"xiaomorentouxiang"]];
                image.layer.masksToBounds = YES;
                image.layer.cornerRadius = 40/2;
                image.layer.borderColor = [UIColor whiteColor].CGColor;
                image.layer.borderWidth = 0;
                image.contentMode = UIViewContentModeScaleAspectFit;
                image.userInteractionEnabled = YES;
                [view addSubview:image];
                UILabel*title=[[UILabel alloc]initWithFrame:CGRectMake(65, 20, 200, 15)];
                title.text=[[severDataDict.dataDict objectForKey:@"mcircle"]objectForKey:@"createName"];
                title.textColor=shenhuicolor;
                title.font=[UIFont systemFontOfSize:15];
                [view addSubview:title];
                UILabel*addresscreateDate=[[UILabel alloc]initWithFrame:CGRectMake(65, 40, 200, 13)];
                addresscreateDate.text=[NSString stringWithFormat:@"%@ %@", [[severDataDict.dataDict objectForKey:@"mcircle"]objectForKey:@"address"],[[severDataDict.dataDict objectForKey:@"mcircle"]objectForKey:@"createDate"]];
                addresscreateDate.textColor=zhonghuiColor;
                addresscreateDate.font=[UIFont systemFontOfSize:13];
                [view addSubview:addresscreateDate];
             
                NSString *s = [NSString stringWithFormat:@"%@", [[severDataDict.dataDict objectForKey:@"mcircle"]objectForKey:@"mcontent"]];
                UIFont *font = [UIFont systemFontOfSize:15];
                CGSize size = CGSizeMake(ScreenWidth-40, 2000);
                CGSize labelsize = [s sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping];
                UILabel*details=[[UILabel alloc]initWithFrame:CGRectMake(15, 70, ScreenWidth-40, labelsize.height+5)];
                details.text=s;
                details.numberOfLines=0;
                details.textColor=shenhuicolor;
                details.font=[UIFont systemFontOfSize:15];
                [view addSubview:details];
                
                if (arr.count>0) {
                    
                    for (int i = 0,j = -1; i < arr.count; i++) {
                        if (i%4 == 0) {
                            j++;
                        }
                    
                        imageView  = [[imageview alloc]initWithFrame:CGRectMake(15+(ScreenWidth-30)/4*(i%4), details.bottom+20+(ScreenWidth-40)/4*j, (ScreenWidth-50)/4, (ScreenWidth-50)/4)];
                        
                        [imageView.buttonViewimage setImageWithURL:[NSURL URLWithString:[[arr objectAtIndex:i] objectForKey:@"imageUrlFull"]] placeholderImage:[UIImage imageNamed:@"xiaomorentouxiang"]];
                      
                        [view addSubview:imageView];
                        
                        
                    }
                    line1=[[UILabel alloc]initWithFrame:CGRectMake(15, imageView.bottom+20, ScreenWidth-30, 0.35)];
                    line1.backgroundColor=qianhuicolor;
                    [view addSubview:line1];
                }else{
                    
                    line1=[[UILabel alloc]initWithFrame:CGRectMake(15, details.bottom+50, ScreenWidth-30, 0.35)];
                    line1.backgroundColor=qianhuicolor;
                    [view addSubview:line1];
                }
      
                
                
                
                
                
                UILabel*praise=[[UILabel alloc]initWithFrame:CGRectMake(15, line1.bottom+10, ScreenWidth-30, 45)];
                praise.text=[NSString stringWithFormat:@"%ld  人赞过",[[severDataDict.dataDict objectForKey:@"praise"]count]];
                praise.textColor=zhonghuiColor;
                praise.font=[UIFont systemFontOfSize:15];
                NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%ld  人赞过",[[severDataDict.dataDict objectForKey:@"praise"]count]]];

                
                [AttributedStr addAttribute:NSFontAttributeName
                 
                                      value:[UIFont systemFontOfSize:15.0]
                 
                                      range:NSMakeRange(0, 3)];
                
                [AttributedStr addAttribute:NSForegroundColorAttributeName
                 
                                      value:shenhuicolor
                 
                                      range:NSMakeRange(0, 3)];
                
                
                praise.attributedText = AttributedStr;
                [view addSubview:praise];
        
                
               
                
               scroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, praise.bottom, ScreenWidth, 50)];
                scroll.bounces = NO;
                [view addSubview:scroll];
                
                commdity.Dict=severDataDict.dataDict;
                
                NSArray *praisearr = [severDataDict.dataDict objectForKey:@"praise"];
                scroll.contentSize = CGSizeMake(50*praisearr.count, 50);
                
                if (praisearr.count>0) {
                    
                    
                    for (int i = 0; i < praisearr.count; i++) {
                        //
                        UIButton* image=[[UIButton alloc]initWithFrame:CGRectMake(10+(40-5)*i, 0, 40, 40)];
                  
                        [image setImageWithURL:[NSURL URLWithString:[[praisearr objectAtIndex:i] objectForKey:@"headImage"]] placeholderImage:[UIImage imageNamed:@"xiaomorentouxiang"]];
                        image.layer.masksToBounds = YES;
                        image.layer.cornerRadius = 40/2;
                       
                      
                        [scroll addSubview:image];
                        
                    }
                }else{
                
                
                
                }

                
                
                
                UIImageView *_xianview = [[UIImageView alloc]initWithFrame:CGRectMake(15,scroll.bottom, ScreenWidth-30, 0.5)];
                _xianview.image=[UIImage imageNamed:@"hengxian"];
                [view addSubview:_xianview];
                if ([[severDataDict.dataDict objectForKey:@"praise"]count]==0) {
                    
                    _xianview.image=[UIImage imageNamed:@""];
                    praise.text=@"";
                }

                
                UILabel*commenct=[[UILabel alloc]initWithFrame:CGRectMake(15, _xianview.bottom+10, ScreenWidth-30, 45)];
                commenct.text=[NSString stringWithFormat:@"%ld  人评论",[[severDataDict.dataDict objectForKey:@"commenct"]count]];
                commenct.textColor=zhonghuiColor;
                commenct.font=[UIFont systemFontOfSize:15];
                NSMutableAttributedString *AttributedStr1 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%ld  人评论",[[severDataDict.dataDict objectForKey:@"commenct"]count]]];
                
                
                [AttributedStr1 addAttribute:NSFontAttributeName
                 
                                      value:[UIFont systemFontOfSize:15.0]
                 
                                      range:NSMakeRange(0, 3)];
                
                [AttributedStr1 addAttribute:NSForegroundColorAttributeName
                 
                                      value:shenhuicolor
                 
                                      range:NSMakeRange(0, 3)];
                
                
                commenct.attributedText = AttributedStr1;
                [view addSubview:commenct];

                

                UIImageView *_xianview1 = [[UIImageView alloc]initWithFrame:CGRectMake(15,commenct.bottom, ScreenWidth-30, 0.5)];
                _xianview1.image=[UIImage imageNamed:@"hengxian"];
                [view addSubview:_xianview1];
                if ([[severDataDict.dataDict objectForKey:@"commenct"]count]==0) {
                    
                    _xianview1.image=[UIImage imageNamed:@""];
                    commenct.text=@"";
                }
                
                view.frame=CGRectMake(0, 0, ScreenWidth, commenct.bottom);
                _table.tableHeaderView=view;
                
                NSMutableArray* arrr=[[NSMutableArray alloc]init];
             
                arrr=[severDataDict.dataDict objectForKey:@"commenct"];
                for (NSDictionary* dicc in arrr )
                {
                    
                    [userName addObject:[dicc valueForKey:@"userName"]];
                    [content addObject:[dicc valueForKey:@"content"]];
//                    [cDate addObject:[dicc valueForKey:@"cDate"]];
                 
                    [headImage addObject:[dicc valueForKey:@"headImage"]];
                    NSString* string =  [dicc valueForKey:@"cDate"];
                    NSLog(@"-------------%@",string);
                    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
                    [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
                    NSDate *destDate= [dateFormatter dateFromString:string];
                    
                    NSTimeInterval  timeInterval = [destDate timeIntervalSinceNow];
                    timeInterval = -timeInterval;
                    
                    NSString *result;
                    
                    long temp = 0;
                    
                    if (timeInterval < 60) {
                        result = [NSString stringWithFormat:@"刚刚"];
                    }
                    else if((temp = timeInterval/60) <60){
                        result = [NSString stringWithFormat:@"%ld分前",temp];
                    }
                    
                    else if((temp = temp/60) <24){
                        result = [NSString stringWithFormat:@"%ld小时前",temp];
                    }
                    
                    else if((temp = temp/24) <30){
                        result = [NSString stringWithFormat:@"%ld天前",temp];
                    }
                    
                    else if((temp = temp/30) <12){
                        result = [NSString stringWithFormat:@"%ld月前",temp];
                    }
                    else{
                        temp = temp/12;
                        result = [NSString stringWithFormat:@"%ld年前",temp];
                    }
                    
                    
                    [cDate addObject:result];
                
                
            }
           
                [[HcCustomKeyboard customKeyboard]textViewShowView:self String1:[severDataDict.dataDict objectForKey:@"isPraise"]    customKeyboardDelegate:self];
             [_table reloadData];
    
            }else{
                
                
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
                
                
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                    
                    TheLoginViewController*detailViewController = [[TheLoginViewController alloc] init];
                    
                    [self.navigationController pushViewController:detailViewController animated:YES];
                    
                }
                
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    imagess=[[UIImageView alloc]initWithFrame:CGRectMake(5, 10, 51/3, 51/3)];
    imagess.image=[UIImage imageNamed:@"_0001_bi.png"];
    [tv addSubview:imagess];
    label=[[UILabel alloc]init];
    label.frame =CGRectMake(30, 8, 150, 15);
    label.text = @"我来说两句";
    label.textColor=qianhuicolor;
    label.font=[UIFont systemFontOfSize:15];
    label.enabled = NO;//lable必须设置为不可用
    label.backgroundColor = [UIColor clearColor];
    [tv addSubview:label];
    
   
    

}
-(void)talkBtnClick:(UITextView *)textViewGet
{
    NSLog(@"%@",textViewGet.text);
    
    
    if (textViewGet.text.length==0)
    {
      
        [self showAlertMessage:@"内容为空"];
    }else{
        if ([textViewGet.text isEqualToString:@"我来说两句..."])
        {
            
            [self showAlertMessage:@"内容为空"];
        }else{
    
    
        NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
        NSString* tokenId = [user1 objectForKey:@"tokenId"];
        NSMutableDictionary *params = [NSMutableDictionary new];
        [params setValue:tokenId forKey:@"tokenId"];
        [params setValue:commdity.reqId forKey:@"mcId"];
         [params setValue:textViewGet.text forKey:@"content"];
        NSLog(@"-----%@",params);
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:10 view:self.view];
        [HttpRequest requestData:@"/Discover/MCircle/AddComment" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                  [Global hideProgressHUDInternal:self.view];
                NSLog(@"-----%@",severDataDict.dataDict);
                textViewGet.text=@"";
                 if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                
                
                 [self setup];
                    
                 }else{
                 
                 
                     NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                     [Global showTextHudSub:requestResultStr view:self.view];
                 
                 
                 }
              
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];

    
    
        }
    
    }
    
    
    
    
}

-(void)guangzhuBtnClick1:(UIButton *)guanzhu
{
    NSLog(@"%@",guanzhu.titleLabel.text);
    
    
    
    
    NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
    NSString* tokenId = [user1 objectForKey:@"tokenId"];
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setValue:tokenId forKey:@"tokenId"];
    [params setValue:commdity.reqId forKey:@"mcId"];
   
    NSLog(@"-----%@",params);
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:10 view:self.view];
    [HttpRequest requestData:@"/Discover/MCircle/Praise" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"-----%@",severDataDict.dataDict);
          
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                
         [[HcCustomKeyboard customKeyboard]textViewShowView:self String1:[severDataDict.dataDict objectForKey:@"isPraise"]    customKeyboardDelegate:self];
            
            }else{
                
                
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
                
                
            }
            
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];

    
    
    
    
    
    
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [userName count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    MCircleCell* cell = (MCircleCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"MCircleCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(0,0, 8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    
    //    cell.accessoryView = jiantou;
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    cell.image.layer.masksToBounds = YES;
    cell.image.layer.cornerRadius = 40/2;
    [cell.image setImageWithURL:[NSURL URLWithString:[headImage objectAtIndex:indexPath.row]] placeholderImage:[UIImage imageNamed:@"xiaomorentouxiang"]];
    
    
    
    cell.name.text =[NSString stringWithFormat:@"%@",  [userName objectAtIndex:indexPath.row]];
    NSString *s2 =[content objectAtIndex:indexPath.row];
    UIFont *font2 = [UIFont systemFontOfSize:15];
    CGSize size2 = CGSizeMake(ScreenWidth-40, 2000);
    CGSize labelsize2 = [s2 sizeWithFont:font2 constrainedToSize:size2 lineBreakMode:NSLineBreakByCharWrapping];
    
    commdity.Education=[NSString stringWithFormat:@"%f", labelsize2.height+20];
    cell.content.frame=CGRectMake(60, 50, ScreenWidth-40,labelsize2.height+20);
    cell.content.text =[NSString stringWithFormat:@"%@",  [content objectAtIndex:indexPath.row]];
    
    
   cell.time.text =[NSString stringWithFormat:@"%@",[cDate objectAtIndex:indexPath.row]];

    if (userName.count !=indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, commdity.Education.intValue+150/3-0.35, ScreenWidth-30, 0.35)];
        lineLabel1.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    if (userName.count ==indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, commdity.Education.intValue+150/3-0.35, ScreenWidth, 0.35)];
        lineLabel1.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    return cell;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
   return commdity.Education.intValue+150/3;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
       
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定哦 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
